<?php
require_once 'Stories.php';
require_once 'Clients.php';

class Admin_StoryController extends HTech_Controller_Action
{
    public function init()
    {  
        $cfg = array(
            'model' => 'Stories', 
            'form' => 'Emms_Form_Admin_Story',
            'config' => array('add' => 'stories', 'log' => '_log_stories')
        );
        parent::init($cfg);    
    }
    
    public function viewAction()
    {   
        $id = (int) $this->_request->getParam('id');
        $m = $this->_cfg['model'];
        try {
            $this->view->$m = $this->_model->getRecord($id);  
        } catch (Exception $e) {
            $this->_helper->flashMessenger->addMessage($e->getMessage());
            $this->redirect('/admin/story/add/client/'.$id); 
        }
        $this->_helper->layout->setLayout('view');
    }
}
